<?php 
include_once 'root.php';
Class Report extends Root{
	private $levelID;
	private $userID;
	public function __construct(){
		parent::__construct();
		$this->levelID = $this->getUserLevel();
		$this->userID = $this->getUserID();
		$this->userID = $this->getSaleID();
		//$this->userID = 3;
		
		$this -> load -> helper('util');
	}
	public function summary(){
		if($this->levelID!="Sales"){
			$this->userID = "";	
		}
		$this->checkAuthen("report","view");
		$this->data['header'] = "Report Summary";
		$this->load->model("reportmodel");
		
		$allRow = $this -> reportmodel -> getSaleRevenueCount($this->userID);
		$pageConfig = $this -> initPagination($allRow); ;
		$this -> data['pagination'] = $this -> pagination;
		
		
		$data = $this->reportmodel->getSaleRevenueData($this->userID,$pageConfig['start'], $pageConfig['limit']);
		$this->data['dataList'] =$data; 
		$this->includeView("viewsalerevenue");
		
	}
	public function viewasalerevenue(){
		$docID = $_GET['docID'];
		$this->checkAuthen("report","view");
		$this->data['header'] = "Report Summary";
		$this->load->model("reportmodel");
		if($this->levelID!="Sales"){
			$this->userID = "";	
		}
		$data = $this->reportmodel->getASaleRevenueData($this->userID,$docID);
		$this->data['dataList'] =$data; 
		$this -> data['docID'] = $docID;
		$this->includeView("viewasalerevenue");
		
	}
	public function other(){
		/**$this->checkAuthen("report","view");
		$this->data['header'] = "Report Summary";
		$this->load->model("reportmodel");
		
		$allRow = $this -> reportmodel -> getSaleRevenueCount($this->userID);
		$pageConfig = $this -> initPagination($allRow); ;
		$this -> data['pagination'] = $this -> pagination;
		
		
		if($this->levelID!="Sales"){
			$this->userID = "";	
		}
		$groupBy = (isset($_GET['groupBy'])) ? $_GET['groupBy'] : "";
		$select = (isset($_GET['select'])) ? $_GET['select'] : "p";
		$start = (isset($_GET['start'])) ? $_GET['start'] : "";
		$end = (isset($_GET['end'])) ? $_GET['end'] : "";
		
		$data = $this->reportmodel->getSummaryOther($this->userID,$groupBy,$select,$start,$end,$pageConfig['start'], $pageConfig['limit']);
		
		$this->data['dataList'] =$data; 
		$this->includeView("reportother");**/
		$this->includeView("wait");
	}
	
}
?>